package com.maslyk.invitation.entitybean;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.PostLoad;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.maslyk.configuration.ConfigurationManager;
import com.maslyk.invitation.audit.ObjectName;
import com.maslyk.invitation.audit.PropertyLabel;
import com.maslyk.invitation.entitybean.abstrct.GenericEntity;
import com.maslyk.invitation.enums.AdditionalStatusEnum;
import com.maslyk.invitation.enums.OrderStatusEnum;
import com.maslyk.invitation.enums.RecordTypeEnum;
import com.maslyk.invitation.service.PersistenceService;

/**
 * 
 * @author kris
 */
@Entity
@Table(name = "ordr")
@ObjectName(label = "Zamówienie")
@NamedQuery(
	    name="findMaxOrderNumberByPattern",
	    query="select max(substring(o.number,2,4)) from Order as o where o.number like :number and o.registrationdate > :date and year is null"
	)
public class Order implements GenericEntity {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;
	@Column(name = "number")
	@PropertyLabel(label = "Numer zamówienia")
	private String number;
	@Column(name = "type")
	@Enumerated(EnumType.STRING)
	@PropertyLabel(label = "Rodzaj pozycji")
	private RecordTypeEnum type = RecordTypeEnum.ORDER;
	@Column(name = "year")
	@PropertyLabel(label = "Rok")
	private Integer year;
	@Column(name = "registrationdate")
	@Temporal(TemporalType.DATE)
	@PropertyLabel(label = "Data rejestracji")
	private Date registrationdate = new Date();
	@Column(name = "dateOfReceipt")
	@Temporal(TemporalType.DATE)
	@PropertyLabel(label = "Data odbioru")
	private Date dateOfReceipt = null;
	@Column(name = "prepayment")
	@PropertyLabel(label = "Zaliczka")
	private Double prepayment = new Double(0.00);
	@Column(name = "totalamount")
	@PropertyLabel(label = "Suma Brutto")
	private Double totalamount = new Double(0.00);
	@Transient
	@PropertyLabel(label = "Suma Netto")
	private Double netAmount = null;
	@Column(name = "status")
	@PropertyLabel(label = "Status")
	private Integer status = OrderStatusEnum.WPROWADZONE.getStatus();
	@Column(name = "additionalStatus")
	@PropertyLabel(label = "Status dodatkowy")
	private Integer additionalStatus = AdditionalStatusEnum.BRAK.getStatus();
	@Column(name = "stuffOrdered")
	@Temporal(TemporalType.DATE)
	@PropertyLabel(label = "Data złożenia zamówienia")
	private Date stuffOrdered = null;
	@Column(name = "approved")
	@Temporal(TemporalType.DATE)
	@PropertyLabel(label = "Data zatwierdzenia")
	private Date approved = null;
	@Column(name = "note", nullable = true)
	@PropertyLabel(label = "Uwagi")
	private String note;
	@Column(name = "shippingcost", nullable = true)
	@PropertyLabel(label = "Koszt wysyłki")
	private Double shippingCost = new Double(0.00);
	@Column(name = "otherCost", nullable = true)
	@PropertyLabel(label = "Inne koszty")
	private Double otherCost = new Double(0.00);
	@Column(name = "email")
	@PropertyLabel(label = "Email")
	private String email;
	@Column(name = "contactPhone")
	@PropertyLabel(label = "Telefon kontaktowy")
	private String contactPhone;
	@Column(name = "clientName")
	@PropertyLabel(label = "Klient")
	private String clientName;
	@Column(name = "receipt")
	@PropertyLabel(label = "Paragon")
	private String receipt;
	@Column(name = "preReceipt")
	@PropertyLabel(label = "Paragon zaliczkowy")
	private String preReceipt;
	@Column(name = "vatInvoiceOut")
	@PropertyLabel(label = "Faktura zakupowa")
	private String vatInvoiceOut;
	@Column(name = "vatInvoiceIn")
	@PropertyLabel(label = "Faktura dochodowa")
	private String vatInvoiceIn;
	@Column(name = "vatInvoiceProform")
	@PropertyLabel(label = "Faktura proforma")
	private String vatInvoiceProform;
	@Column(name = "shippingNo")
	@PropertyLabel(label = "Numer wysyłki")
	private String shippingNo;
	@Column(name = "shippingAddress")
	@PropertyLabel(label = "Adres wysyłki")
	private String shippingAddress;
	@Column(name = "shippingDispatchDate")
	@Temporal(TemporalType.DATE)
	@PropertyLabel(label = "Data nadania przesyłki")
	private Date shippingDispatchDate = null;
	@Column(name = "deliveryType")
	@PropertyLabel(label = "Odbiór")
	private String deliveryType;
	@Column(name = "isNetAmount")
	@PropertyLabel(label = "Zamówienie netto")
	private Boolean isNetAmount;
	
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, targetEntity = Salesman.class)
	@JoinColumn(name = "salesmanID")
	private Salesman salesmanID;
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, targetEntity = Salesman.class)
	@JoinColumn(name = "responsible")
	@PropertyLabel(label = "Odpowiedzialny")
	private Salesman responsible;
	
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Client.class)
	@JoinColumn(name = "clientId")
	private Client client = new Client();
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Invitation> invitationEntityCollection = new ArrayList<Invitation>();

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Insertion> insertionCollection = new ArrayList<Insertion>();

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Vigniette> vignietteCollection = new ArrayList<Vigniette>();

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Product> productCollection = new ArrayList<Product>();

	@OrderBy("registrationDate DESC")
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Comment> commentList = new ArrayList<Comment>();

	@OrderBy("creationDate DESC")
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Attachment> attachmentList = new ArrayList<Attachment>();

	@OrderBy("date DESC")
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.LAZY)
	private List<Payment> paymentList = new ArrayList<Payment>();

	@Transient
	private String productCodes = null;
	
	public Order() {
	}

	public Order(Integer id) {
		this.id = id;
	}

	public Order(Integer id, Date registrationdate, Double totalamount,
			String bridename, String bridegroom, Date weddingDateTime) {
		this.id = id;
		this.registrationdate = registrationdate;
		this.totalamount = totalamount;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Salesman getSalesmanID() {
		return salesmanID;
	}

	public void setSalesmanID(Salesman salesmanID) {
		// wpisujemy tylko osobe rejestrujaca
		if (this.salesmanID == null)
			this.salesmanID = salesmanID;
	}

	public String getCreatorName() {
		return getSalesmanID().toString();
	}

	public String getResponsibleName() {
		return getResponsible().toString();
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public RecordTypeEnum getType() {
		return type;
	}

	public void setType(RecordTypeEnum type) {
		this.type = type;
	}

	public Date getRegistrationdate() {
		if (registrationdate == null)
			registrationdate = new Date();

		return registrationdate;
	}

	public void setRegistrationdate(Date registrationdate) {
		this.registrationdate = registrationdate;
	}

	public Double getPrepayment() {
		return prepayment;
	}

	public void setPrepayment(Double prepayment) {
		this.prepayment = prepayment;
	}

	public Double getNetAmount() {
		
		if(getIsNetAmount() == false)
			throw new IllegalStateException("Proba wyliczenia kwoty netto gdy zamowienie prowadzone jest w Brutto!");
		
		if(netAmount == null)
			getTotalamount();
		
		return netAmount;
	}

	public Double getTotalamount() {
		totalamount = new Double(0.00);

		for (Invitation invitation : getInvitationEntityCollection())
			totalamount = totalamount + invitation.getAmount();

		for (Insertion insertion : getInsertionCollection())
			totalamount = totalamount + insertion.getAmount();

		for (Vigniette vigniette : getVignietteCollection())
			totalamount = totalamount + vigniette.getAmount();

		for (Product product : getProductCollection())
			totalamount = totalamount + product.getAmount();

		// zsumowanie kosztow przesylki i innych kosztow opisanych w uwagach
		if (shippingCost != null)
			totalamount = totalamount + shippingCost;
		if (otherCost != null)
			totalamount = totalamount + otherCost;
		
		netAmount = totalamount;
		
		if(isNetAmount != null && isNetAmount == true)
			totalamount *= 1.23;

		BigDecimal amountRounded = new BigDecimal(totalamount);
		amountRounded.setScale(2, BigDecimal.ROUND_HALF_UP);
		return amountRounded.doubleValue();
	}

	public Double getSumOfPayments() {

		Double sumOfPayments = new Double(0.00);

		if (getPaymentList() == null)
			return sumOfPayments;

		for (Payment payment : getPaymentList())
			sumOfPayments = sumOfPayments + payment.getAmount();
		
		BigDecimal amountRounded = new BigDecimal(sumOfPayments);
		amountRounded.setScale(2, BigDecimal.ROUND_HALF_UP);
		return amountRounded.doubleValue();
	}

	/**
	 * Zwraca kwote brutto zamowienia bez mechanizmu przeliczenia.
	 * @return
	 */
	public Double getTotalamountForList() {
		return this.totalamount;
	}

	public void setTotalamount(Double totalamount) {
		this.totalamount = totalamount;
	}

	public Integer getStatus() {
		return status;
	}

	public String getStatusEnum() {
		return OrderStatusEnum.getStatus(status).toString();
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getAdditionalStatus() {

		Double totalAmount = getTotalamount();
		Double sumOfPayments = getSumOfPayments();

		if ((totalAmount.doubleValue() == 0 && sumOfPayments.doubleValue() == 0)
				|| (totalAmount.doubleValue() > 0 && sumOfPayments
						.doubleValue() == 0))
			additionalStatus = AdditionalStatusEnum.BRAK.getStatus();

		if ((totalAmount.doubleValue() > 0 && sumOfPayments.doubleValue() > 0)
				&& totalAmount.doubleValue() > sumOfPayments.doubleValue())
			additionalStatus = AdditionalStatusEnum.ZALICZKA.getStatus();

		if (totalAmount.doubleValue() > 0 && sumOfPayments.doubleValue() > 0
				&& totalAmount.compareTo(sumOfPayments) == 0)
			additionalStatus = AdditionalStatusEnum.CALOSC.getStatus();

		if ((totalAmount.doubleValue() == 0 && sumOfPayments.doubleValue() > 0)
				|| (totalAmount.doubleValue() > 0
						&& sumOfPayments.doubleValue() > 0 && totalAmount
						.compareTo(sumOfPayments) == -1))
			additionalStatus = AdditionalStatusEnum.NADPLATA.getStatus();

		return additionalStatus;
	}

	public String getAdditionalStatusEnum() {
		return AdditionalStatusEnum.getStatus(additionalStatus).name();
	}

	public void setAdditionalStatus(Integer additionalStatus) {
		this.additionalStatus = additionalStatus;
	}

	public Date getStuffOrdered() {
		return stuffOrdered;
	}

	public void setStuffOrdered(Date stuffOrdered) {
		this.stuffOrdered = stuffOrdered;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Double getOtherCost() {
		return otherCost;
	}

	public void setOtherCost(Double otherCost) {
		this.otherCost = otherCost;
	}

	public Double getShippingCost() {
		return shippingCost;
	}

	public void setShippingCost(Double shippingCost) {
		this.shippingCost = shippingCost;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getContactPhone() {
		return contactPhone;
	}

	public void setContactPhone(String contactPhone) {
		this.contactPhone = contactPhone;
	}

	public String getReceipt() {
		return receipt;
	}

	public void setReceipt(String receipt) {
		this.receipt = receipt;
	}

	public String getPreReceipt() {
		return preReceipt;
	}

	public void setPreReceipt(String preReceipt) {
		this.preReceipt = preReceipt;
	}

	public Double getRestOfPayment() {
		if (totalamount == null)
			return null;

		Double prep = prepayment == null ? new Double(0.00) : prepayment.doubleValue();

		Double paymentSum = new Double(0.00);

		if (paymentList != null)
			for (Payment pay : paymentList)
				paymentSum = paymentSum + pay.getAmount();

		return totalamount.doubleValue() - prep.doubleValue() - paymentSum.doubleValue();
	}

	public Date getDateOfReceipt() {
		if(dateOfReceipt != null)
			return dateOfReceipt;
		
		if (approved == null)
			return null;
		
		Date referenceDate = null;
		
		if (approved != null && getAdditionalStatusEnum().equals(AdditionalStatusEnum.BRAK))
			referenceDate = approved;
		else if (approved != null && !getAdditionalStatusEnum().equals(AdditionalStatusEnum.BRAK))
		{
			List<Payment> paymlist = getPaymentList();
			
			if(paymlist == null || paymlist.isEmpty())
				return null;
			
			referenceDate = paymlist.get(0).getDate();
		}
		else
			return null;

		Calendar cal = Calendar.getInstance();
		cal.setTime(referenceDate);
		cal.add(Calendar.DATE, 8);
		dateOfReceipt = cal.getTime();

		return dateOfReceipt;
	}

	public void setDateOfReceipt(Date dateOfReceipt) {
		this.dateOfReceipt = dateOfReceipt;
	}

	/**
	 * metoda bierze dwa wspolczynniki ilosc godzin przez 2 tygodnie - 336 oraz
	 * kolor RGB od 255 do 0
	 */
	public String getColorDateOfReceipt() {
		
		StringBuilder color = new StringBuilder();
		Integer daysToReceipt = getDaysTo();
		
		if(dateOfReceipt == null || (daysToReceipt != null && daysToReceipt > 2))
			return color.toString();
		
		color.append("background-color:#FF0000");

		return color.toString();
	}

	public Integer getDaysTo() {
		if(dateOfReceipt == null)
			return null;
		
		int result = (int) ((this.dateOfReceipt.getTime() - System.currentTimeMillis()) / 86400000);
		return Integer.valueOf(result);
	}

	public List<Invitation> getInvitationEntityCollection() {
		return invitationEntityCollection;
	}

	public void setInvitationEntityCollection(
			List<Invitation> invitationEntityCollection) {
		this.invitationEntityCollection = invitationEntityCollection;
	}

	public List<Insertion> getInsertionCollection() {
		return insertionCollection;
	}

	public void setInsertionCollection(List<Insertion> insertionCollection) {
		this.insertionCollection = insertionCollection;
	}

	public List<Vigniette> getVignietteCollection() {
		return vignietteCollection;
	}

	public void setVignietteCollection(List<Vigniette> vignietteCollection) {
		this.vignietteCollection = vignietteCollection;
	}

	public List<Comment> getCommentList() {
        Collections.sort(commentList, new Comment.CommentComparator());

		return commentList;
	}

	public void setCommentList(List<Comment> commentList) {
		this.commentList = commentList;
	}

	public String getClientName() {
		return clientName;
	}

	public void setClientName(String clientName) {
		this.clientName = clientName;
	}

	public List<Product> getProductCollection() {
		return productCollection;
	}

	public void setProductCollection(List<Product> productCollection) {
		this.productCollection = productCollection;
	}

	public List<Attachment> getAttachmentList() {
		return attachmentList;
	}

	public void setAttachmentList(List<Attachment> attachmentList) {
		this.attachmentList = attachmentList;
	}

	public Salesman getResponsible() {
		return responsible;
	}

	public void setResponsible(Salesman responsible) {
		this.responsible = responsible;
	}

	public String getShippingNo() {
		return shippingNo;
	}

	public void setShippingNo(String shippingNo) {
		this.shippingNo = shippingNo;
	}

	public String getShippingAddress() {
		return shippingAddress;
	}

	public void setShippingAddress(String shippingAddress) {
		this.shippingAddress = shippingAddress;
	}

	public Integer getYear() {
		return year;
	}

	public void setYear(Integer year) {
		this.year = year;
	}

	public Date getApproved() {
		return approved;
	}

	public void setApproved(Date approved) {
		this.approved = approved;
	}

	public boolean getApprovedBoolean() {
		return approved != null;
	}

	public void setApprovedBoolean(boolean approved) {

		if (approved)
			this.approved = new Date();
		else
			this.approved = null;
	}

	public boolean isOffer() {
		return type.equals(RecordTypeEnum.OFFER);
	}

	public List<Payment> getPaymentList() {
		return paymentList;
	}

	public void setPaymentList(List<Payment> paymsts) {
		this.paymentList = paymsts;
	}

	public Client getClient() {
		
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	public String getProductCode() {

		StringBuffer buf = new StringBuffer(20);


		for (Product prd : getProductCollection())
			buf.append(prd.getCode()).append(",");

		productCodes = buf.toString();

		return productCodes;
	}

	@PrePersist
	public void runBeforePersist() throws Exception {
		
		if (type.equals(RecordTypeEnum.OFFER))
			setNumber("O");

		if (ConfigurationManager.getInstance().isAutomaticNumberGeneration()) {
			// generacja numeru zamowienia
			// ustawienie roku na 1 styczen 00h:00m
			Calendar cal = Calendar.getInstance();
			cal.set(Calendar.MONTH, 0);
			cal.set(Calendar.DAY_OF_YEAR, 1);
			cal.set(Calendar.HOUR_OF_DAY, 0);
			cal.set(Calendar.MINUTE, 0);
			
	    	ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext("applicationContext.xml");
	    	PersistenceService service = (PersistenceService) springContext.getBean("persistenceService");

			Long lastNumber = 0L;
			SimpleDateFormat format = new SimpleDateFormat("/MM/yy");
			String monthYear = format.format(new Date());
			String lastStrNumber = service.findMaxOrderNumberByPattern(this.getNumber() + "%", cal.getTime());

			if (lastStrNumber != null && lastStrNumber.length() > 0)
				lastNumber = Long.valueOf(lastStrNumber);

			String orderNum = String.format("%04d", ++lastNumber);
			String orderNumber = this.getNumber() + orderNum + monthYear;

			this.setNumber(orderNumber);
			// koniec generacji numeru zamowienia
		}

		// kod wykonywany tylko w przypadku wstawiania nowego zamowienia
//		StringBuffer message = new StringBuffer();
//		message.append("U\u017cytkownik <i>"
//				+ this.getSalesmanID().getPersonid().getFirstname() + " "
//				+ this.getSalesmanID().getPersonid().getSurname()
//				+ "</i><br />");
//		message.append("zarejestrowa\u0142 nowe zam\u00f3wienie o numerze: <strong>"
//				+ this.getNumber() + "</strong>.<br />");
//		message.append("Data odbioru zam\u00f3wienia przez Klienta to: "
//				+ DateTimeUtils.formatDate(this.getDateOfReceipt(),
//						OrderXMLService.datePattern));
//		MessagingEmailService emailService = new MessagingEmailService();
//		emailService.sendMessage("biuro@studiografic.pl", message.toString(),
//				"Zarejestrowano nowe zam\u00f3wienie: " + this.getNumber());
	}

	public static String getBeanName() {
		return "orderBean";
	}

	public String getKey() {
		return number;
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		Order ordr = (Order) super.clone();
		ordr.setId(null);

		List<Invitation> invitationEntityList = new ArrayList<Invitation>();

		for (Invitation inv : invitationEntityCollection) {
			Invitation invTmp = (Invitation) inv.clone();
			invTmp.setOrderID(ordr);
			invitationEntityList.add(invTmp);
		}
		ordr.setInvitationEntityCollection(invitationEntityList);

		List<Insertion> insertionList = new ArrayList<Insertion>();

		for (Insertion ins : insertionCollection) {
			Insertion insTmp = (Insertion) ins.clone();
			insTmp.setOrder(ordr);
			insertionList.add(insTmp);
		}
		ordr.setInsertionCollection(insertionList);

		List<Vigniette> vignietteList = new ArrayList<Vigniette>();

		for (Vigniette v : vignietteCollection) {
			Vigniette vTmp = (Vigniette) v.clone();
			vTmp.setOrder(ordr);
			vignietteList.add(vTmp);
		}
		ordr.setVignietteCollection(vignietteList);

		List<Product> productList = new ArrayList<Product>();

		for (Product p : productCollection) {
			Product pTmp = (Product) p.clone();
			pTmp.setOrder(ordr);
			productList.add(pTmp);
		}
		ordr.setProductCollection(productList);

		List<Attachment> attachments = new ArrayList<Attachment>();

		for (Attachment a : attachmentList) {
			Attachment aTmp = (Attachment) a.clone();
			aTmp.setId(null);
			aTmp.setOrder(ordr);
			attachments.add(aTmp);
		}
		ordr.setAttachmentList(attachments);

		List<Comment> comments = new ArrayList<Comment>();

		for (Comment c : commentList) {
			Comment cTmp = (Comment) c.clone();
			cTmp.setId(null);
			cTmp.setOrder(ordr);
			comments.add(cTmp);
		}
		ordr.setCommentList(comments);

		List<Payment> payments = new ArrayList<Payment>();

		for (Payment pay : paymentList) {
			Payment pTmp = (Payment) pay.clone();

			pTmp.setId(null);
			pTmp.setOrder(ordr);
			payments.add(pTmp);
		}

		ordr.setPaymentList(payments);

		return ordr;
	}

	public boolean isInserted() {
		return id != null;
	}

	public String getLastComments() {
		if (commentList == null || commentList.isEmpty())
			return null;
		
		StringBuffer buffer = new StringBuffer();
		
		int counter = Math.min(3, commentList.size());
		while(counter >= 0){
			buffer.append(commentList.get(counter).getNote()).append("<hr>");
			counter--;
		}

		return buffer.toString();
	}

	public Date getShippingDispatchDate() {
		return shippingDispatchDate;
	}

	public void setShippingDispatchDate(Date shippingDispatchDate) {
		this.shippingDispatchDate = shippingDispatchDate;
	}

	public String getDeliveryType() {
		return deliveryType;
	}

	public void setDeliveryType(String deliveryType) {
		this.deliveryType = deliveryType;
	}

	public String getVatInvoiceOut() {
		return vatInvoiceOut;
	}

	public void setVatInvoiceOut(String vatInvoiceOut) {
		this.vatInvoiceOut = vatInvoiceOut;
	}

	public String getVatInvoiceIn() {
		return vatInvoiceIn;
	}

	public void setVatInvoiceIn(String vatInvoiceIn) {
		this.vatInvoiceIn = vatInvoiceIn;
	}

	public String getVatInvoiceProform() {
		return vatInvoiceProform;
	}

	public void setVatInvoiceProform(String vatInvoiceProform) {
		this.vatInvoiceProform = vatInvoiceProform;
	}

	public Boolean getIsNetAmount() {
		return isNetAmount;
	}

	public void setIsNetAmount(Boolean isNetAmount) {
		this.isNetAmount = isNetAmount;
	}
	
	/**
	 * metoda tylko dla zapewnienia bilansu otwarcia
	 */
	@PostLoad
	public void loadClientData(){
		
	}
}
